﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Data.Common;
using DataAccess;

public partial class Manager_ChangerPassCandidate : System.Web.UI.Page
{
    string id;
    protected void Page_Load(object sender, EventArgs e)
    {
        DataTable tblData = new DataTable();
        id = Request.QueryString["canID"];

        tblData = RegisterCandidate.GetDetailCandidate(id);
        txtPasswordCurrent.Text = tblData.Rows[0]["PassWord"].ToString();

    }

    protected void btnChange_Click(object sender, EventArgs e)
    {
        string ConfirmPass = txtConfirmPassword.Text;

        string md5Passnew = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(ConfirmPass, "MD5").ToLower();
       
        DbCommand cmd = GenericData.CreateCommand();
        cmd.CommandText = "UPDATE Candidate SET Password = '" + md5Passnew + "' WHERE ID = " + id.ToString();
        if (GenericData.ExecuteNoneQuery(cmd) > 0)
            MessagesBox.Show("Changer Success !");
        else
            MessagesBox.Show("Not Changer !Please again ...");
        
    }
}